package com.resou.reader.dialog;

import android.support.v4.app.FragmentManager;
import android.util.Log;

import com.resou.reader.dialog.fifteenfree.FifteenFreeDialog;
import com.resou.reader.dialog.limitedrecharge.LimitedRechargeDialog;
import com.resou.reader.dialog.threeDaysrecharge.ThreeDaysRechargeDialog;
import com.resou.reader.mine.login.LoginFragment;

public class DialogManager {
    public static void showLoginDialog(FragmentManager fragmentManager) {
        LoginFragment fragment = LoginFragment.getInstance();
        if (fragment.isAdded()) {
            fragment.dismiss();
        }
        fragment.show(fragmentManager, "login_dialog");
    }

    public static void showLimitedRechargeDialog(FragmentManager fragmentManager) {
        LimitedRechargeDialog dialog = LimitedRechargeDialog.newInstance();
        if (dialog.isAdded()) {
            dialog.dismiss();
        }
        dialog.show(fragmentManager, "limited_time_recharge_dialog");
    }

    public static void showFifteenFreeDialog(FragmentManager fragmentManager) {
        try {
            FifteenFreeDialog dialog = FifteenFreeDialog.newInstance();
            if (dialog.isAdded()) {
                dialog.dismiss();
            }
            dialog.show(fragmentManager, "fifteen_free_dialog");
        } catch (Exception e) {
            Log.i("abc", "showFifteenFreeDialog: " + e.getMessage());
        }
    }

    public static void showThreeDaysRechargeDialog(FragmentManager fragmentManager, String price) {

        ThreeDaysRechargeDialog dialog = ThreeDaysRechargeDialog.newInstance(price);
        dialog.show(fragmentManager, "reader_recharge_dialog");
    }


}
